package com.enzoism.springboot.fastjson.request;

import com.enzoism.springboot.fastjson.define.PasswordEqual;
import com.enzoism.springboot.fastjson.define.WorkTime;
import com.enzoism.springboot.fastjson.group.First;
import com.enzoism.springboot.fastjson.group.Second;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

@Data
@PasswordEqual(message="两次输入密码不相同")
public class PeopleModel {

    //在First分组时，判断不能为空
    @NotEmpty(groups = {First.class}, message = "first分组校验 id不能为空")
    private String id;

    //name字段不为空，且长度在3-8之间
    @NotEmpty(groups = {First.class}, message = "first分组校验 name不能为空")
    @Size(min = 3, max = 8, groups = {Second.class}, message = "second分组校验 <3name<8")
    private String name;

    // 校验密码是否一致
    private String password1;
    private String password2;

    @WorkTime(max = 5, message = "工作时间不能超过5小时！")
    private Integer workTime;

}